package com.wxq.day0426.mapper;

import com.wxq.day0426.pojo.Customer;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @Author wxq
 * @Date 2021/4/26
 **/
public interface CustomerMapper {

    /**
     * 根据用户 id 查询 Customer
     *
     * @param id 用户ID
     * @return
     */
    Customer find(long id);

    /**
     * 根据用户 ID 查询 Customer （同时查询 Address ）
     *
     * @param id
     * @return
     */
    Customer findWithAddress(long id);

    /**
     * 根据 orderId 查询 Customer
     *
     * @param orderId
     * @return
     */
    Customer findByOrderId(long orderId);

    /**
     * 保存(持久化) Customer 对象
     *
     * @param customer
     * @return
     */
    int save(Customer customer);

    /**
     * 根据条件查询用户
     */
    List<Customer> findByCondition(@Param("id") Integer id,@Param("name") String name);

    int saveCustomer(@Param("c") Customer customer,Integer id);

}
